/**
 * Copyright (C), 2002-2017, 上海巧房信息技术有限公司
 * FileName: CollectRuleServiceConvert
 * @Author:   yi.li
 * Date:     2018/6/29 17:18
 * Description: 采集规则服务转换器
 * History: //修改记录
 * <author>      <time>      <version>    <desc>
 * 修改人姓名             修改时间            版本号                  描述
 */
package com.qiaofang.collectmanage.service.util;

import com.qiaofang.collectmanage.dao.domain.CollectRule;
import com.qiaofang.collectmanage.dao.domain.HouseAgent;
import com.qiaofang.collectmanage.stub.bean.*;
import com.qiaofang.collectmanage.stub.constants.DeletedEnum;
import com.qiaofang.common.util.ConverterBeanUtil;

import java.util.Date;
import java.util.UUID;

public class HouseAgentServiceConvert {

    private HouseAgentServiceConvert(){}

    public static HouseAgentDTO convertDomain2DTO( HouseAgent  houseAgent) {
        if (houseAgent == null) {
            return null;
        }
        HouseAgentDTO houseAgentDTO = new HouseAgentDTO();
        ConverterBeanUtil.copyBeanProperties(houseAgent, houseAgentDTO);
        return houseAgentDTO;
    }

    public static CollectRule convertDTO2Domain(CollectRuleDTO collectRuleDTO) {
        if (collectRuleDTO == null) {
            return null;
        }
        CollectRule collectRule = new CollectRule();
        collectRule.setId(collectRuleDTO.getId());
        collectRule.setUuid(collectRuleDTO.getUuid());
        collectRule.setCity(collectRuleDTO.getCity());
        collectRule.setSource(collectRuleDTO.getSource());
        collectRule.setBelonger(collectRuleDTO.getBelonger());
        collectRule.setCollectHouseType(collectRuleDTO.getCollectHouseType());
        collectRule.setCollectType(collectRuleDTO.getCollectType());
        collectRule.setWebsite(collectRuleDTO.getWebsite());
        collectRule.setListWebCode(collectRuleDTO.getListWebCode());
        collectRule.setDetailWebCode(collectRuleDTO.getDetailWebCode());
        collectRule.setDefaultPages(collectRuleDTO.getDefaultPages());
        collectRule.setTopicName(collectRuleDTO.getTopicName());
        collectRule.setCreatedUserId(collectRuleDTO.getCreatedUserId());
        collectRule.setUpdatedUserId(collectRuleDTO.getUpdatedUserId());
        collectRule.setCreatedTime(collectRuleDTO.getCreatedTime());
        collectRule.setUpdatedTime(collectRuleDTO.getUpdatedTime());
        collectRule.setDeleted(collectRuleDTO.getDeleted());
        return collectRule;
    }

    public static CollectRule convertListDTO2Domain(ListCollectRuleDTO collectRuleDTO) {
        if (collectRuleDTO == null) {
            return null;
        }
        CollectRule collectRule = new CollectRule();
        collectRule.setId(collectRuleDTO.getId());
        collectRule.setUuid(collectRuleDTO.getUuid());
        collectRule.setCity(collectRuleDTO.getCity());
        collectRule.setSource(collectRuleDTO.getSource());
        collectRule.setBelonger(collectRuleDTO.getBelonger());
        collectRule.setCollectHouseType(collectRuleDTO.getCollectHouseType());
        collectRule.setCollectType(collectRuleDTO.getCollectType());
        collectRule.setWebsite(collectRuleDTO.getCollectUrl());
        collectRule.setListWebCode(collectRuleDTO.getListWebCode());
        collectRule.setDetailWebCode(collectRuleDTO.getDetailWebCode());
        collectRule.setDefaultPages(collectRuleDTO.getDefaultPages());
        collectRule.setTopicName(collectRuleDTO.getTopicName());
        collectRule.setCreatedUserId(collectRuleDTO.getCreatedUserId());
        collectRule.setUpdatedUserId(collectRuleDTO.getUpdatedUserId());
        collectRule.setCreatedTime(collectRuleDTO.getCreatedTime());
        collectRule.setUpdatedTime(collectRuleDTO.getUpdatedTime());
        return collectRule;
    }

    public static CollectRule convertSaveDTO2Domain(SaveCollectRuleDTO saveCollectRuleDTO) {
        if (saveCollectRuleDTO == null) {
            return null;
        }
        CollectRule collectRule = new CollectRule();
        collectRule.setUuid(UUID.randomUUID().toString());
        collectRule.setCity(saveCollectRuleDTO.getCity());
        collectRule.setSource(saveCollectRuleDTO.getSource());
        collectRule.setBelonger(saveCollectRuleDTO.getBelonger());
        collectRule.setCollectHouseType(saveCollectRuleDTO.getCollectHouseType());
        collectRule.setCollectType(saveCollectRuleDTO.getCollectType());
        collectRule.setWebsite(saveCollectRuleDTO.getWebsite());
        collectRule.setListWebCode(saveCollectRuleDTO.getListWebCode());
        collectRule.setDetailWebCode(saveCollectRuleDTO.getDetailWebCode());
        collectRule.setDefaultPages(saveCollectRuleDTO.getDefaultPages());
        collectRule.setTopicName(saveCollectRuleDTO.getTopicName());
        collectRule.setCreatedUserId(saveCollectRuleDTO.getCreatedUserId());
        collectRule.setUpdatedUserId(saveCollectRuleDTO.getUpdatedUserId());
        collectRule.setCreatedTime(new Date());
        collectRule.setUpdatedTime(new Date());
        collectRule.setDeleted(DeletedEnum.NO.getValue());
        return collectRule;
    }

    public static CollectRule convertUpdateDTO2Domain(UpdateCollectRuleDTO updateCollectRuleDTO) {
        if (updateCollectRuleDTO == null) {
            return null;
        }
        CollectRule collectRule = new CollectRule();
        collectRule.setId(updateCollectRuleDTO.getId());
        collectRule.setUuid(updateCollectRuleDTO.getUuid());
        collectRule.setCity(updateCollectRuleDTO.getCity());
        collectRule.setSource(updateCollectRuleDTO.getSource());
        collectRule.setBelonger(updateCollectRuleDTO.getBelonger());
        collectRule.setCollectHouseType(updateCollectRuleDTO.getCollectHouseType());
        collectRule.setCollectType(updateCollectRuleDTO.getCollectType());
        collectRule.setWebsite(updateCollectRuleDTO.getWebsite());
        collectRule.setListWebCode(updateCollectRuleDTO.getListWebCode());
        collectRule.setDetailWebCode(updateCollectRuleDTO.getDetailWebCode());
        collectRule.setDefaultPages(updateCollectRuleDTO.getDefaultPages());
        collectRule.setTopicName(updateCollectRuleDTO.getTopicName());
        collectRule.setCreatedUserId(updateCollectRuleDTO.getCreatedUserId());
        collectRule.setUpdatedUserId(updateCollectRuleDTO.getUpdatedUserId());
        collectRule.setUpdatedTime(new Date());
        collectRule.setDeleted(updateCollectRuleDTO.getDeleted());
        return collectRule;
    }


    public static HouseAgent convertGetDTO2Domain(GetHouseAgentDTO getHouseAgentDTO) {
        if (getHouseAgentDTO == null) {
            return null;
        }
        HouseAgent houseAgent = new HouseAgent();
        ConverterBeanUtil.copyBeanProperties(getHouseAgentDTO, houseAgent);
        return houseAgent;
    }

    public static UpdateCollectRuleDTO convertSaveDTO2Update(SaveCollectRuleDTO saveCollectRuleDTO) {
        if (saveCollectRuleDTO == null) {
            return null;
        }
        UpdateCollectRuleDTO updateCollectRuleDTO = new UpdateCollectRuleDTO();
        updateCollectRuleDTO.setCity(saveCollectRuleDTO.getCity());
        updateCollectRuleDTO.setSource(saveCollectRuleDTO.getSource());
        updateCollectRuleDTO.setBelonger(saveCollectRuleDTO.getBelonger());
        updateCollectRuleDTO.setCollectHouseType(saveCollectRuleDTO.getCollectHouseType());
        updateCollectRuleDTO.setCollectType(saveCollectRuleDTO.getCollectType());
        updateCollectRuleDTO.setWebsite(saveCollectRuleDTO.getWebsite());
        updateCollectRuleDTO.setListWebCode(saveCollectRuleDTO.getListWebCode());
        updateCollectRuleDTO.setDetailWebCode(saveCollectRuleDTO.getDetailWebCode());
        updateCollectRuleDTO.setDefaultPages(saveCollectRuleDTO.getDefaultPages());
        updateCollectRuleDTO.setTopicName(saveCollectRuleDTO.getTopicName());
        updateCollectRuleDTO.setCreatedUserId(saveCollectRuleDTO.getCreatedUserId());
        updateCollectRuleDTO.setUpdatedUserId(saveCollectRuleDTO.getUpdatedUserId());
        updateCollectRuleDTO.setDeleted(saveCollectRuleDTO.getDeleted());
        return updateCollectRuleDTO;
    }


    public static com.qiaofang.collectmanage.domain.CollectRule convertCollectRuleToResolveCollect(CollectRule collectRule) {
        if (collectRule == null) {
            return null;
        }
        com.qiaofang.collectmanage.domain.CollectRule resolveCollectRule = new com.qiaofang.collectmanage.domain.CollectRule();

        return resolveCollectRule;
    }


}
